package com.cloudkinto.service.order.impl;

import cn.hutool.core.collection.ListUtil;
import com.cloudkinto.entity.PlatformOrderCopyDo;
import com.cloudkinto.dao.PlatformOrderCopyDao;
import com.cloudkinto.service.order.PlatformOrderCopyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.cloudkinto.common.constant.SysConstant;
import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;

/**
 * <p>
 *  service实现类
 * </p>
 * @author long
 * @since 2025-04-14
 */
@Service
@Transactional(rollbackFor = Exception.class)//事务回滚
public class PlatformOrderCopyServiceImpl extends ServiceImpl<PlatformOrderCopyDao, PlatformOrderCopyDo> implements PlatformOrderCopyService {

    @Override
    public void batchInsert(List<PlatformOrderCopyDo> list) {
        if (CollectionUtils.isEmpty(list)) {
            return;
        }
        List<List<PlatformOrderCopyDo>> partition = ListUtil.partition(list, 2000);
        for (List<PlatformOrderCopyDo> platformOrderCopyDos : partition) {
            baseMapper.batchInsert(platformOrderCopyDos);
        }
    }
}
